<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Wallpage_model extends CI_Model
{
	
	public function __construct()
	{
		parent::__construct();

	}
	public function get_user_details($id)
	{
		$this->db->select('users.*,users_groups.*');
		$this->db->from('users');
		$this->db->where('users.id = '.$id);
		$this->db->join('users_groups','users.id = users_groups.user_id');
		return $this->db->get()->row_array();
	}
	function userdetails($id)
	{
		$this->db->select('users.*');
    	$this->db->from('users');
    	$this->db->where('users.id =',$id);
		$userdetails = $this->db->get();
		return $userdetails->result();
	}
	function designationbyid($id)
	{
		$this->db->select('users_groups.*,user_type.*');
    	$this->db->from('user_type');
    	$this->db->join('users_groups', 'user_type_id = user_type.id');
		$this->db->where('users_groups.user_id =',$id);
		$designationbyid = $this->db->get();
		return $designationbyid->result();
	}
	function coffeebyid($id)
	{
		$this->db->select('coffee.*');
    	$this->db->from('users');
    	$this->db->join('coffee', 'user_id = users.id');
		$this->db->where('coffee.user_id =',$id);
		$coffeebyid = $this->db->get();
		return $coffeebyid->result();
	}
	function badges_getall()
	{
	    $badges = $this->db->get('badges');
	    return $badges->result();
	}
	function user_badges_insert($insert)
	{
		foreach($insert as $badges)			
			{
			$this->db->insert('user_badges',$badges);
			}
	}
	
	function star_insert($insert)
	{
		$this->db->insert('stars',$insert);
	}

}


	
	
